package com.nguyen.letcook;

import android.app.Activity;
import android.os.Bundle;
import android.view.ViewGroup;

import com.nguyen.views.ListCategoryView;
import com.nguyen.views.ListDishView;

public class LetCookActivity extends Activity {
  
	ListDishView mDishView;
	ListCategoryView mCategoryView;
	ViewGroup container;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mDishView = new ListDishView(this, true, 1);
        setContentView(R.layout.main);
        container = (ViewGroup) findViewById(R.id.container);
        container.addView(mDishView);
    }
    
    /**
     * 
     * @param categoryId
     * if categoryId == -1: do not reload
     */
    public void setDishView(int categoryId){
    	container.removeAllViews();
    	if(categoryId != -1)
    		mDishView = new ListDishView(this, true, categoryId);
    	container.addView(mDishView);
    	mCategoryView = null;
    }
    
    public void setListCategory(){
    	container.removeAllViews();
    	mCategoryView = new ListCategoryView(this, true);
    	container.addView(mCategoryView);
    }
}